home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / amok_lha / amok15.lha / Seafarers_Manual / Source / C2P4.mod < prev    next >
Text File  |  1993-08-15  |  617b  |  25 lines

  1. MODULE C2P4;   (* Chapter 2  Problem 4 *)
  2.            (* Real Calculation Sample *)
  3.  
  4.    (* From the book "Modula-2  A Seafarer's Manual and Shipyard Guide" *)
  5.    (* Page 40   adapted "M2Amiga Modula-2"   26 Feb 1988 *)
  6.  
  7. FROM InOut IMPORT WriteLn,
  8.           WriteString;
  9. FROM RealInOut IMPORT WriteReal;
  10.                   
  11. VAR
  12.   Result : REAL;
  13.   
  14. BEGIN
  15.   WriteString ("Real Calculation Sample: ");
  16.   WriteLn; WriteLn; WriteLn;
  17.   WriteString ("The result of the calculation (((1.0/3.0)*3.0)-1.0) = ");
  18.   Result := 1.0 / 3.0;
  19.   Result := Result * 3.0;
  20.   Result := Result - 1.0;
  21.   WriteReal (Result,20,15);
  22.   WriteLn;
  23.   
  24. END C2P4.
  25.